Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
@babel/plugin-transform-class-properties
Advanced tools
This plugin transforms static class properties as well as properties declared with the property initializer syntax
The @babel/plugin-transform-class-properties npm package allows developers to use the class properties syntax in JavaScript. It transforms static and instance properties so that they can be used in environments that do not support this feature natively.
Static Class Properties
This feature allows you to define static properties on a class, which are properties that belong to the class itself rather than to instances of the class.
class MyClass { static myStaticProp = 42; }
Instance Class Properties
This feature enables you to define properties directly on class instances, with an initial value, without needing to set them inside the class constructor.
class MyClass { myInstanceProp = 'default value'; }
This package is a successor to @babel/plugin-transform-class-properties and includes the proposal for class properties as it moves through the TC39 process. It offers similar functionality but aligns with the latest proposal spec.
While not identical, this package provides functionality for handling private methods and accessors in classes, which is related to the class fields feature that @babel/plugin-transform-class-properties handles.
This package includes @babel/plugin-transform-class-properties as one of the plugins it might use to transform code. It provides a broader range of transformations based on the target environment's ECMAScript feature support.
This plugin transforms static class properties as well as properties declared with the property initializer syntax
See our website @babel/plugin-transform-class-properties for more information.
Using npm:
npm install --save-dev @babel/plugin-transform-class-properties
or using yarn:
yarn add @babel/plugin-transform-class-properties --dev
v7.25.4 (2024-08-22)
babel-traverse
babel-helper-create-class-features-plugin
, babel-plugin-proposal-decorators
babel-types
babel-generator
export namespace as A
(@nicolo-ribaudo)babel-generator
, babel-plugin-proposal-decorators
, babel-plugin-proposal-destructuring-private
, babel-plugin-proposal-pipeline-operator
, babel-plugin-transform-class-properties
, babel-plugin-transform-destructuring
, babel-plugin-transform-optional-chaining
, babel-plugin-transform-private-methods
, babel-plugin-transform-private-property-in-object
, babel-plugin-transform-typescript
, babel-runtime-corejs2
, babel-runtime
, babel-traverse
babel-generator
, babel-plugin-transform-class-properties
babel-generator
, babel-plugin-proposal-decorators
, babel-plugin-proposal-destructuring-private
, babel-plugin-transform-object-rest-spread
babel-generator
FAQs
This plugin transforms static class properties as well as properties declared with the property initializer syntax
The npm package @babel/plugin-transform-class-properties receives a total of 17,091,632 weekly downloads. As such, @babel/plugin-transform-class-properties popularity was classified as popular.
We found that @babel/plugin-transform-class-properties demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.